﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;

namespace FrostGraphics.Umbraco.ContactForm {
  public partial class ContactFormControl : System.Web.UI.UserControl {

    /// <summary>
    /// The name of the contactForm in the configurationfile
    /// </summary>
    public String SectionName { get; set; }

    protected void Page_Load(object sender, EventArgs e) {

      if (String.IsNullOrWhiteSpace(SectionName)) {
        throw new NullReferenceException("You must define a SectionName in the contactform usercontrol!");
      }
      else {
        ContactFormFactory form = new ContactFormFactory(SectionName);
        form.AddControlsTo(formPlaceholder);
      }

    }
  }
}